#!/bin/sh

wd="`pwd`"


. $wd/CONF

echo ""
echo " This script will copy all packages that appear listed in:  "
echo " 		./initrd-tree.installcd/nemonico/files/packages/pkglist/default "
echo ""
if [ ! "$sets_location" ]; then
	echo " Enter path to where the original slackware sets"
	echo -n " 	 are located: "
	read sets_location
fi

if [ ! -d $sets_location ]; then
	echo " It does not exist or is not a directory, exiting..."
	exit 1
fi
	
if [ -d $wd/initrd-tree.installcd/nemonico/files/packages/pkglist/default ]; then

	mkdir -p $wd/cdtree/slackware
	t="$wd/initrd-tree.installcd/nemonico/files/packages/pkglist/default"
	for f in `ls $t`; do
		echo " Copying for set [`echo $f|sed -e 's/\.pkglist//g'`] ..."
		cp -fpr ${sets_location}/`cat $f` $wd/cdtree/slackware
	done

	echo " Done. "
fi
